package com.zdemo.pressure.simple;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

public class RequestThreadFactory implements ThreadFactory {

	private final String poolName;
	private static final AtomicInteger created = new AtomicInteger();

	public RequestThreadFactory(String poolName) {
		this.poolName = poolName;
	}

	@Override
	public Thread newThread(Runnable r) {
		created.incrementAndGet();
		return new RequestThread(r, poolName + "-" + created);
	}

}
